<%@ page import="buscar.Busca"%>
<%@ page pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;" />
<meta name="layout" content="main" />
<g:set var="entityName"
	value="${message(code: 'busca.label', default: 'Busca')}" />
<title><g:message code="default.list.label" args="[entityName]" />
</title>
</head>
<body>
	<div class="nav">
		<span class="menuButton"><g:link class="BuscarController" action="list">Nova Busca</g:link></span>
		<span class="menuButton"><a href="javascript:window.history.go(-1)">Voltar</a>
</span>
	</div>
	<div class="body">
		<h1>Comparar Veículos</h1>
		<g:if test="${flash.message}">
			<div class="message">
				${flash.message}
			</div>
		</g:if>
		<div class="list">
			<table>
				<thead>
					<tr>
						<g:sortableColumn property="cliente" title="Proprietário" />   
					
						<g:sortableColumn property="marca" title="Marca" />

						<g:sortableColumn property="modelo" title="Modelo" />

						<g:sortableColumn property="ano" title="Ano" />

						<g:sortableColumn property="valor" title="Valor" />

						<g:sortableColumn property="cor" title="Cor" />

						<g:sortableColumn property="direcaoHidraulica"
							title="Direção Hidráulica" />

						<g:sortableColumn property="arCondicionado"
							title="Ar Condicionado" />

						<g:sortableColumn property="vidrosEletricos"
							title="Vidros Elétricos" />

						<g:sortableColumn property="cambioAutomatico"
							title="Câmbio Automático" />

						<g:sortableColumn property="travasEletricas"
							title="Travas Elétricas" />

						<g:sortableColumn property="quatroPortas" title="Quatro Portas" />

						<g:sortableColumn property="som" title="Som" />

						<g:sortableColumn property="alarme" title="Alarme" />

						<g:sortableColumn property="sensorDeEstacionamento"
							title="Sensor de Estacionamento" />

						<g:sortableColumn property="quatroPorQuatro" title="4x4" />
					</tr>
				</thead>
				<tbody>
					<g:each in="${listaVeiculosComparados}" status="i" var="veiculo">
						<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
							
							<td>
								${fieldValue(bean: veiculo, field: "cliente")}
							</td>
							
							<td>
								${fieldValue(bean: veiculo, field: "marca")}
							</td>

							<td>
								${fieldValue(bean: veiculo, field: "modelo")}
							</td>

							<td>
								${fieldValue(bean: veiculo, field: "ano")}
							</td>

							<td>
								${fieldValue(bean: veiculo, field: "valor")}
							</td>

							<td>
								${fieldValue(bean: veiculo, field: "cor")}
							</td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "direcaoHidraulica") == "true"}'>
									<g:checkBox name="direcaoHidraulica" checked="true"
										disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="direcaoHidraulica" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "arCondicionado") == "true"}'>
									<g:checkBox name="arCondicionado" checked="true"
										disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="arCondicionado" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "vidrosEletricos") == "true"}'>
									<g:checkBox name="vidrosEletricos" checked="true"
										disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="vidrosEletricos" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "cambioAutomatico") == "true"}'>
									<g:checkBox name="cambioAutomatico" checked="true"
										disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="cambioAutomatico" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "travasEletricas") == "true"}'>
									<g:checkBox name="travasEletricas" checked="true"
										disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="travasEletricas" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "quatroPortas") == "true"}'>
									<g:checkBox name="quatroPortas" checked="true" disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="quatroPortas" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "som") == "true"}'>
									<g:checkBox name="som" checked="true" disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="som" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "alarme") == "true"}'>
									<g:checkBox name="alarme" checked="true" disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="alarme" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "sensorDeEstacionamento") == "true"}'>
									<g:checkBox name="sensorDeEstacionamento" checked="true"
										disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="sensorDeEstacionamento" disabled="true" />
								</g:else></td>

							<td><g:if test='${fieldValue(bean: veiculo, field: "quatroPorQuatro") == "true"}'>
									<g:checkBox name="quatroPorQuatro" checked="true"
										disabled="true" />
								</g:if> <g:else>
									<g:checkBox name="quatroPorQuatro" disabled="true" />
								</g:else></td>
						</tr>
					</g:each>
				</tbody>
			</table>
		</div>
	</div>
</body>
</html>
